package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.wap.dao.IFpShopProductTypeDao;
import com.financing.wap.dto.FpShopProductTypeDTO;
import com.financing.wap.service.IFpShopProductTypeService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * fp_shop_product_type  
 * 自有产品分类 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("fpShopProductTypeService")
public class FpShopProductTypeServiceImpl implements IFpShopProductTypeService{

	@Autowired
	private IFpShopProductTypeDao fpShopProductTypeDao;

	@Override
	public int insert(FpShopProductTypeDTO fpShopProductType) throws SQLException {
		DTOdateSetUtil.setCreateInfo(fpShopProductType);
		DTOdateSetUtil.setUpdateInfo(fpShopProductType);
		return fpShopProductTypeDao.insert(fpShopProductType);
	}

	@Override
	public void update(FpShopProductTypeDTO fpShopProductType) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpShopProductType);
		fpShopProductTypeDao.update(fpShopProductType);
	}

	@Override
	public void updateForce(FpShopProductTypeDTO fpShopProductType) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpShopProductType);
		fpShopProductTypeDao.updateForce(fpShopProductType);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		fpShopProductTypeDao.delete(id);
	}
	
	@Override
	public List<FpShopProductTypeDTO> queryList(FpShopProductTypeDTO fpShopProductType) throws SQLException {
		return fpShopProductTypeDao.queryList(fpShopProductType);
	}

	@Override
	public int queryListCount(FpShopProductTypeDTO fpShopProductType) throws SQLException {
		return fpShopProductTypeDao.queryListCount(fpShopProductType);
	}

	@Override
	public FpShopProductTypeDTO loadById(Integer id) throws SQLException {
		return fpShopProductTypeDao.loadById(id);
	}
 	@Override
	public FpShopProductTypeDTO queryListGetFirst(FpShopProductTypeDTO fpShopProductType)
			throws SQLException {
		 List<FpShopProductTypeDTO> queryList = queryList(fpShopProductType);
		 if(queryList==null||queryList.size()==0){
			 return new FpShopProductTypeDTO();
		 }
		 return queryList.get(0);
	}
}
